package ab.mes.mapper;

import ab.mes.entity.Bin;
import ab.mes.entity.MaterialBinOut;
import ab.mes.entity.Orders;
import ab.mes.entity.Staff;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface BinMapper extends BaseMapper<Bin> {
    //查询物料库位信息
    @Select("select * from bin")
    List<Bin> getBin();

    //查询库位编号物料库位信息
    @Select("select * from bin where bin_no = #{bin_no}")
    Bin getBinById(@Param("bin_no") String Id);

    //停启用物料库位
    @Update("update bin set bin_state = #{bin_state} where bin_no = #{bin_no}")
    void updateStateById(@Param("bin_no")String id,@Param("bin_state")Boolean bin_state);

    //编辑物料库位


    //查询物料出库管理信息
    @Select("select orders.order_no,orders.production_no,orders.product_model_name,orders.item_no," +
            "scheduling.plan_Time,scheduling.delivery_Time from orders,scheduling" +
            "${ew.customSqlSegment}")
    IPage<MaterialBinOut> getMaterialBinOut(IPage<MaterialBinOut> page, @Param("ew") Wrapper wrapper);
}
